package com.salton123.colorflydemo.ui.adapter

import androidx.recyclerview.widget.RecyclerView
import cn.bingoogolapple.baseadapter.BGARecyclerViewAdapter
import cn.bingoogolapple.baseadapter.BGAViewHolderHelper
import com.salton123.GlideApp
import com.salton123.bmob.biz.mandala.bean.MandalaItem
import com.salton123.colorflydemo.R
import com.salton123.util.ScreenUtils

/**
 * User: newSalton@outlook.com
 * Date: 2019/6/3 14:42
 * ModifyTime: 14:42
 * Description:
 */
class MandalaMainAdapter(recyclerView: RecyclerView) :
        BGARecyclerViewAdapter<MandalaItem>(recyclerView,
                R.layout.adapter_item_mandala_home_list) {

    override fun fillData(helper: BGAViewHolderHelper?, position: Int, model: MandalaItem?) {
        helper?.let {
            it.setText(R.id.tvName, model?.name ?: "")
            GlideApp.with(it.convertView).load(model?.url)
                    .override(ScreenUtils.dp2px(150f), ScreenUtils.dp2px(150f))
                    .into(it.getImageView(R.id.ivIcon))
        }
    }
}